﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// Summary description for WebCommon
/// </summary>
public class WebCommon
{
    public WebCommon()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public static string GetFileIcon(string fileName)
    {
        fileName = fileName.ToLower();
        if (fileName.EndsWith(".doc") || fileName.EndsWith(".wbk") || fileName.EndsWith(".dot"))
            return "/UI Standard/icon/FileType/doc.gif";
        else if (fileName.EndsWith(".mda") || fileName.EndsWith(".mdt") || fileName.EndsWith(".mdb")
            || fileName.EndsWith(".mdn") || fileName.EndsWith(".adn") || fileName.EndsWith(".maw")
            || fileName.EndsWith(".mdz") || fileName.EndsWith(".mag") || fileName.EndsWith(".maf")
            || fileName.EndsWith(".mam") || fileName.EndsWith(".mde") || fileName.EndsWith(".mad")
            || fileName.EndsWith(".adp") || fileName.EndsWith(".ade") || fileName.EndsWith(".maq")
            || fileName.EndsWith(".ldb") || fileName.EndsWith(".mar") || fileName.EndsWith(".mas")
            || fileName.EndsWith(".mat") || fileName.EndsWith(".mav") || fileName.EndsWith(".mdw"))
            return "/UI Standard/icon/FileType/Access.gif";
        else if (fileName.EndsWith(".chm"))
            return "/UI Standard/icon/FileType/chm.gif";
        else if (fileName.EndsWith(".exe") || fileName.EndsWith(".com"))
            return "/UI Standard/icon/FileType/exe.gif";
        else if (fileName.EndsWith(".gif") || fileName.EndsWith(".bmp") || fileName.EndsWith(".jpg")
            || fileName.EndsWith(".jpeg") || fileName.EndsWith(".jpe") || fileName.EndsWith(".pcx")
            || fileName.EndsWith(".png") || fileName.EndsWith(".pic") || fileName.EndsWith(".psd")
            || fileName.EndsWith(".tif") || fileName.EndsWith(".tiff"))
            return "/UI Standard/icon/FileType/gif.gif";
        else if (fileName.EndsWith(".hlp"))
            return "/UI Standard/icon/FileType/help.gif";
        else if (fileName.EndsWith(".htm") || fileName.EndsWith(".html") || fileName.EndsWith(".htw")
            || fileName.EndsWith(".htx") || fileName.EndsWith(".url"))
            return "/UI Standard/icon/FileType/htm.gif";
        else if (fileName.EndsWith(".mp2") || fileName.EndsWith(".mpa") || fileName.EndsWith(".mp3")
            || fileName.EndsWith(".wav") || fileName.EndsWith(".wma"))
            return "/UI Standard/icon/FileType/mp3.gif";
        else if (fileName.EndsWith(".rm") || fileName.EndsWith(".ra") || fileName.EndsWith(".ram")
            || fileName.EndsWith(".rmvb"))
            return "/UI Standard/icon/FileType/ra.gif";
        else if (fileName.EndsWith(".rar") || fileName.EndsWith(".r01") || fileName.EndsWith(".r02")
            || fileName.EndsWith(".r03") || fileName.EndsWith(".r04") || fileName.EndsWith(".r05")
            || fileName.EndsWith(".r06") || fileName.EndsWith(".r07") || fileName.EndsWith(".r08")
            || fileName.EndsWith(".r09") || fileName.EndsWith(".r10") || fileName.EndsWith(".7z")
            || fileName.EndsWith(".arj") || fileName.EndsWith(".jar") || fileName.EndsWith(".lzh")
            || fileName.EndsWith(".lha") || fileName.EndsWith(".iso"))
            return "/UI Standard/icon/FileType/rar.gif";
        else if (fileName.EndsWith(".swf"))
            return "/UI Standard/icon/FileType/swf.gif";
        else if (fileName.EndsWith(".txt"))
            return "/UI Standard/icon/FileType/txt.gif";
        else if (fileName.EndsWith(".zip") || fileName.EndsWith(".cab"))
            return "/UI Standard/icon/FileType/zip.gif";
        else if (fileName.EndsWith(".xls") || fileName.EndsWith(".xla") || fileName.EndsWith(".xlk")
            || fileName.EndsWith(".csv") || fileName.EndsWith(".dif") || fileName.EndsWith(".xlt")
            || fileName.EndsWith(".xlv") || fileName.EndsWith(".xlw") || fileName.EndsWith(".xll"))
            return "/UI Standard/icon/FileType/xls.gif";
        else
            return "/UI Standard/icon/FileType/other.gif";

    }
}
